import { APP_FLIGHT_PATH, callService } from '@/common/common.js'

export function saveSupplier(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/supplier/create'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

// 设置为默认供应商
export function updateDefaultSupplier(id, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/supplier/' + id + '/default'
  callService(url, {
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

// 设置为BSP开票供应商
export function updateBspSupplier(id, params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/supplier/' + id + '/bsp'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function searchSuppliers(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/suppliers'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function searchSupplier(id, cbDone) {
  const url = APP_FLIGHT_PATH + '/supplier/' + id
  callService(url, {
    type: 'get',
    cbDone: cbDone
  })
}

export function savePaymentMethod(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/payment/method/create'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchPaymentMethods(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/payment/methods'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}





export function saveIncomeMethod(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/income/method/create'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchIncomeMethods(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/income/methods'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}



export function searchAirports(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/data/airports'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function createAirport(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/airport'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchAirlines(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/airlines'
  callService(url, {
    type: 'get',
    data: params,
    cbDone: cbDone
  })
}

export function createAirlines(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/airlines'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchSubclasses(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/subclasses'
  callService(url, {
    type: 'get',
    data: params,
    cbDone: cbDone
  })
}

export function getSubclassInfo(id, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/subclass/' + id
  callService(url, {
    type: 'get',
    cbDone: cbDone
  })
}

export function searchFlightConditionTimeWindow(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/flightConditionTimeWindow'
  callService(url, {
    type: 'get',
    data: params,
    cbDone: cbDone
  })
}

export function saveFlightConditionTimeWindow(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/flightConditionTimeWindow'
  callService(url, {
    contentType: 'application/json',
    data: params,
    cbDone: cbDone
  })
}

export function saveSubclass(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/subclass'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchAirlineSchedules(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/airline/schedules'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function searchFuelSurcharge(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/fuelSurcharges'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function createFuelSurcharge(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/fuelSurcharge'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function deleteFuelSurcharge(id, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/fuelSurcharge/' + id
  callService(url, {
    type: 'delete',
    cbDone: cbDone
  })
}

export function searchKeyCustomerPolicies(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/flight/keyCustomerPolicies'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function savePassengerFlightPolicy(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/passenger-flight-policy'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}

export function saveKeyCustomerPolicy(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/flight/keyCustomerPolicy'
  callService(url, {
    type: 'POST',
    data: params,
    cbDone: cbDone
  })
}

//查找行李额信息
export function searchLuggages(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/luggages'
  callService(url, {
    type: 'get',
    data: params,
    cbDone: cbDone
  })
}

export function getLuggage(id, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/luggage/' + id
  callService(url, {
    type: 'get',
    cbDone: cbDone
  })
}

//保存行李信息
export function saveLuggageInfo(params, cbDone) {
  const url = APP_FLIGHT_PATH + '/data/luggage'
  callService(url, {
    data: params,
    cbDone: cbDone
  })
}





//车型组
export function searchVehicleGroupInfos(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/vehicleGroups'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function saveVehicleGroupInfo(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/vehicleGroup'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function saveVehicleGroupMapping(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/vehicleGroupMapping'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}


export function searchCities(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/data/cities'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function saveCity(params, cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/data/city'
  callService(url, {
    data: params,
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

export function getAllCities(cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/data/cities'
  callService(url, {
    data: 'sc.pageNo=1&sc.pageSize=10000',
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

//API产品供应商
export function searchApiProdcutSuppliers(cbDone, cbAlways) {
  const url = APP_FLIGHT_PATH + '/api-product-suppliers'
  callService(url, {
    type: 'get',
    cbDone: cbDone,
    cbAlways: cbAlways
  })
}

